<!DOCTYPE html>
<html>
    <head>
        <title>获得失去焦点练习</title>
        <meta charset="utf-8">
        <script language="JavaScript">
            function tip(){
                document.getElementById("hint").innerHTML="请输入半径！";
            }
            function output_square(){
                var r =document.getElementById('hinted').value;
                r=parseInt(r);
                var S=3.14*r*r;
                alert(S);
            }
        </script>
    </head>
    <body>
        <input type="text" id="hinted" onfocus="tip()" onblur="output_square()">
        <p id="hint"></p>
    </body>
</html>